/**
 * @created by helin3 2018-04-16
 * @updated by
 * @description 自动化构建工具入口
 */
var gulp = require('gulp');
var requireDir = require('require-dir');
var config = require('./src/util/alias').alias;

requireDir('./src/build/common');
requireDir('./src/build/test');
requireDir('./src/build/business');

var tasks = ['custom', 'lib', 'theme', 'page', 'entry'];
if (config.extra) {
  var extra = config.extra.split(',');
  extra.forEach(function (taskName) {
    tasks.push(taskName);
  });
}
if (config.buildMock) {
  tasks.push('mock');
}
if (config.parallel) {
  gulp.task('app', gulp.series('app--clean', gulp.parallel.call(this, tasks), 'app--zip'));
} else {
  gulp.task('app', gulp.series('app--clean', gulp.series.call(this, tasks), 'app--zip'));
}
